package partes_GUI.Stats_GUI;

import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;

import javax.swing.JScrollBar;

public class StatScrollBar extends JScrollBar {

	private class IncDecStatListener implements AdjustmentListener{
		
		public IncDecStatListener(){
			campo=null;
		}
		public void adjustmentValueChanged(AdjustmentEvent arg0) {
			for(int i=0; i<campo.length;i++)
			campo[i].actualizar();
		}
	}
	
	private static final long serialVersionUID = 8444627472641651684L;

	protected StatTF[] campo;
	
	public StatScrollBar(){
		super(JScrollBar.VERTICAL,0,1,0,50);
		this.addAdjustmentListener(new IncDecStatListener());
		this.setUnitIncrement(-1);
	}
	
	public void setCampos(StatTF[] st){
		campo=st;
		for (StatTF s: campo)
			s.setSSB(this);
	}
}
